<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <title>运动会管理系统</title>
    <meta name="keywords" content="运动会管理系统"/>
    <meta name="description" content="运动会管理系统"/>
    <link href="/statics/css/layout.css" rel="stylesheet" type="text/css">
    <link href="/statics/css/login.css" rel="stylesheet" type="text/css">
</head>
<style>
    .ibar {
        display: none;
    }
</style>
<body class="login-bg">
<div class="main  " id="rrapp">
    <!--登录-->
    <div class="login-dom login-max">
        <div class="logo text-center">
            <a href="#">
                <img src="/statics/image/logo.png" width="160px" height="160px">
            </a>
        </div>
        <div class="login container " id="login">
            <p class="text-big text-center logo-color">
                运动会管理系统-注册
            </p>

            <form class="login-form" onsubmit="return false" method="post" autocomplete="off">
                <div class="login-box border text-small" id="box">
                    <div class="name border-bottom">
                        <input type="text" placeholder="请填写帐号信息" v-model="username" id="username" name="username"
                               datatype="*" nullmsg="请填写帐号信息">
                    </div>
                    <div class="pwd">
                        <input type="password" placeholder="请填写帐号密码" v-model="password" datatype="*" id="password"
                               name="password" nullmsg="请填写帐号密码">
                    </div>
                    <div class="pwd">
                        <input type="password" placeholder="请再次输入密码" v-model="password2" datatype="*" id=" " name=" "
                               nullmsg="请再次输入密码">
                    </div>
                </div>
                <input type="submit" class="btn text-center login-btn" @click="reg" value="立即注册">
            </form>
            <div class="forget">
            </div>
        </div>
    </div>

    <div class="footer text-center text-small ie">

        <script src="#" language="JavaScript"></script>
    </div>
    <div class="popupDom">
        <div class="popup text-default">
        </div>
    </div>
</div>


<!-- /.login-box -->
<script src="statics/libs/jquery.min.js"></script>
<script src="statics/libs/vue.min.js"></script>
<script src="statics/libs/bootstrap.min.js"></script>
<script src="statics/libs/jquery.slimscroll.min.js"></script>
<script src="statics/libs/fastclick.min.js"></script>
<script src="statics/plugins/layer/layer.js"></script>
<script src="statics/libs/app.js"></script>
<script type="text/javascript">
    var vm = new Vue({
        el: '#rrapp',
        data: {
            username: null,
            password: null,
            password2: null,
            captcha: null,
            error: false,
            errorMsg: null,
            src: 'captcha.jpg'
        },
        beforeCreate: function () {
            if (self != top) {
                top.location.href = self.location.href;
            }
        },
        created: function () {
        },
        methods: {
            refreshCode: function () {
                this.src = "captcha.jpg?t=" + $.now();
            },
            showError: function (msg) {
               layer.msg(msg)
            },
            reg: function (event) {
                if (this.username == null) {
                    vm.showError("请输入登录账号");
                    return;
                }
                if (this.password == null) {
                    vm.showError("请输入登录密码");
                    return;
                }
                if (this.password2 == null) {
                    vm.showError("请再次输入登录密码");
                    return;
                }
                if (this.password != this.password2) {
                    vm.showError("两次密码不同");
                    return;
                }


                var data = "username=" + this.username + "&password=" + this.password + "&captcha=" + this.captcha;
                $.ajax({
                    type: "POST",
                    url: "sys/reg",
                    data: data,
                    dataType: "json",
                    success: function (result) {
                        if (result.code == 0) {//注册成功

                            alert("注册成功");
                            history.back();
                        } else {
                            vm.showError(result.msg);
                            vm.refreshCode();
                        }
                    }
                });
            }
        }
    });
</script>
</body>
</html>